<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="common/common_head :: commonHeader('供应商银行信息')" />
<link th:href="@{/static/css/plugins/cropper/cropper.min.css}"
	rel="stylesheet">
</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<form class="form-horizontal" method="post" id="vendorBankInfoFrom">
			<div class="row">
				<div class="form-group">
					<div class="col-sm-8" style="margin-left: 16px">
						<input class="btn btn-primary" type="button" onclick="save()"
							value="保存">
						<button class="btn btn-primary" type="button"
							onclick="Dialog.closeFrame(window.name)">取 消</button>
					</div>
				</div>
				<div class="form-group">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5 style="padding-left: 15px;">银行信息</h5>
						</div>
						<div class="ibox-content">
							<div class="form-group">
								<ul>
									<li class="col-sm-3" style="width: 20%"><label
										class="col-sm-1 control-label" style="width: 40%">供应商名称：</label>
										<div class="col-sm-3" style="width: 60%">
											<select class="form-control" id="vendorName" name="vendorId"
												style="width: 99%"></select>
										</div></li>
									<li class="col-sm-3" style="width: 20%"><label
										class="col-sm-1 control-label" style="width: 40%">国家：</label>
										<div class="col-sm-3" style="width: 60%">
											<select class="form-control" id="countrySelbank"
												name="bankI18n" sysDict="GJ" emptyFirst="true"></select>
										</div></li>
									<li class="col-sm-3" style="width: 20%"><label
										class="col-sm-1 control-label" style="width: 40%">银行代码：</label>
										<div class="col-sm-3" style="width: 60%">
											<input name="bankCode" type="text" placeholder="银行代码"
												class="form-control" style="width: 99%">
										</div></li>
									<li class="col-sm-3" style="width: 20%"><label
										class="col-sm-1 control-label" style="width: 40%">银行账号：</label>
										<div class="col-sm-3" style="width: 60%">
											<input name="bankAccountNo" type="text" placeholder="银行账号"
												class="form-control" style="width: 99%">
										</div></li>
									<li class="col-sm-3" style="width: 20%"><label
										class="col-sm-1 control-label" style="width: 40%">银行开户行：</label>
										<div class="col-sm-3" style="width: 60%">
											<input name="bankOpen" type="text" placeholder="银行开户行"
												class="form-control" style="width: 99%">
										</div></li>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>

	<!--引入公共js-->
	<div th:include="common/onload_js :: onloadJS"></div>
	<!-- Chosen -->
	<script th:src="@{/static/js/plugins/chosen/chosen.jquery.js}"></script>

	<script type="text/javascript">
		$(function() {
	        //自动往select框里面填充字典数据
	        var sels = $("#vendorName");
	        Page.ajaxGET(ctxPath + "/vendor/findSimpleAll", {}, function(o) {
		        var res = o.result;
		        for( var k in res) {
			        sels.append("<option value='"+k+"'>" + res[k] + "</option>");// 添加option
		        }
	        }, {
		        async : false
	        });

	        initDictDataSel();//初始化所有字典数据
        });

        function save() {
	        if($("#vendorBankInfoFrom").valid()) {
		        Page.ajaxPOST(ctxPath + "/vendorBankInfo/save", $('#vendorBankInfoFrom').serialize(), function(res) {
			        Dialog.msg("新增成功!", function() {
				        parent.refresh();
				        Dialog.closeFrame(window.name);
			        });
		        });
	        }
        }
	</script>

</body>
</html>
